import Vue from 'vue'
import VueRouter from 'vue-router'
import Testcase from '../views/Testcase.vue'
import Layout from '../views/Layout.vue'
import Task from '../views/Task.vue'

// 加载了VueRouter
Vue.use(VueRouter)

// 路由管理
const routes = [

  {
    // 指定路由
    path: '/',
    // 指定渲染哪个组件
    // component: Home
    // 指定重定向页面
    redirect: "/layout/case"
  },
  {
    path: "/layout",
    component: Layout,
    children:[
      {
        path: "case",
        name: "case",
        component: Testcase
      },
      {
        path: "task",
        name: "task",
        component: Task
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
